


import React,{ Component} from 'react';
import { Table } from 'antd';
const dataSource = [{
    key: '1',
    name: '碗碗香',
    age: 22,
    address: '北京市',
    action: '习惯优秀',
    render: text=> <a href="#">{ text }</a>,
},{
    key: '2',
    name: '小小',
    age: 18,
    address: '深圳市',
    action: '习惯优秀',
},{
    key: '3',
    name: '天使里',
    age: 25,
    address: '天晶石',
    action: '习惯优秀',
},{
    key: '4',
    name: 'Disabled User',
    age: 22,
    address: '西安市',
    action: '习惯优秀',
}];

const columns = [{
    title: '姓名',
    dataIndex: 'name',
    key: 'name',
    render: text=><a href="#">{ text }</a>
},{
    title: '年龄',
    dataIndex: 'age',
    key: 'age',
    render: text=><a href="#">{ text }</a>
},{
    title: '地址',
    dataIndex: 'address',
    key: 'address',
},{
    title: '动作',
    dataIndex: 'action',
    key: 'action',
}]
//下文中的Table组件中会用到这个变量，因此一定要声明,即使给一个空的对象也可以的
//const rowSelection = {}

const rowSelection = {
    onChange: ( selectedRowKeys,selectedRows ) =>{
        console.log(`selectedRowKeys: ${ selectedRowKeys },selectedRows:${ selectedRows }`);
    },
    //record 得到一个对应的对象
    getCheckboxProps: record =>({
        //然后禁止掉
        disabled: record.name === 'Disabled User',
    })
}
class TabCheckBox1  extends Component {
    constructor(props) {
        super(props);
        this.state = {

        }
    }
    render() {
        return(
            <div>
                <Table  rowSelection={ rowSelection } columns={ columns } dataSource={ dataSource} />
            </div>
        )
    }
}
export default TabCheckBox1